package com.qububu.emporium.comment.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.qububu.db.dao.impl.GoodsCommentDaoImpl;
import com.qububu.emporium.comment.dto.GoodsCommentInfoDto;
import com.qububu.emporium.comment.service.CommentService;

@Service
public class CommentServiceImpl implements CommentService {

	@Resource
	private GoodsCommentDaoImpl goodsCommentDao;
	
	/**
	 * @author HQ
	 * @功能 根据商品id获取评价详情
	 * @param goodsId 是商品的id
	 * @return List 是返回该商品的评价详情
	 * */
	public List<GoodsCommentInfoDto> getGoodsCommentById(int goodsId) {
		// TODO Auto-generated method stub
		
		List<GoodsCommentInfoDto> list = goodsCommentDao.getGoodsCommentsByGoodsId(goodsId);
		
		return list;
	}
	
	
	/**
	 * @author HQ
	 * @功能 添加对商品的评价
	 * @return goodsCommentInfoDto
	 * */
	public GoodsCommentInfoDto doAddGoodsComment(GoodsCommentInfoDto goodsCommentInfoDto) {
		// TODO Auto-generated method stub
		// 添加到数据库
		goodsCommentDao.doAddGoodsComment(goodsCommentInfoDto);
		
		return goodsCommentInfoDto;
	}
}
